 #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <chrono>

void sorting(std::vector<int>& a) {
    for (size_t i = 0; i < a.size() - 1; ++i) {
        for (size_t j = i + 1; j < a.size(); ++j) {
            if (a[i] > a[j]) {
                std::swap(a[i], a[j]);
            }
        }
    }
}

int main() {
    std::ifstream file1("m1_sorted.txt");
    std::ifstream file2("m2_reverse.txt");
    std::ifstream file3("m3_shuffle.txt");

    std::vector<int> a, b, c;
    int num;
    while (file1 >> num) {
        a.push_back(num);
    }
    while (file2 >> num) {
        b.push_back(num);
    }
    while (file3 >> num) {
        c.push_back(num);
    }

    auto t1 = std::chrono::high_resolution_clock::now();
    sorting(a);
    auto t2 = std::chrono::high_resolution_clock::now();
    std::cout << "m1_sorted " << std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1).count() << " milliseconds" << std::endl;

    auto t3 = std::chrono::high_resolution_clock::now();
    sorting(b);
    auto t4 = std::chrono::high_resolution_clock::now();
    std::cout << "m2_reverse " << std::chrono::duration_cast<std::chrono::milliseconds>(t4 - t3).count() << " milliseconds" << std::endl;

    auto t5 = std::chrono::high_resolution_clock::now();
    sorting(c);
    auto t6 = std::chrono::high_resolution_clock::now();
    std::cout << "m3_shuffle " << std::chrono::duration_cast<std::chrono::milliseconds>(t6 - t5).count() << " milliseconds" << std::endl;

    return 0;
}
